<?php
namespace app\middleware;

use Webman\MiddlewareInterface;
use Webman\Http\Response;
use Webman\Http\Request;

class ApiMain implements MiddlewareInterface
{
    public function process(Request $request, callable $handler) : Response
    {
        if(($request->controller=="app\api\controller\UpdateFileController" and $request->action=="updateImg") or $request->controller=="app\api\controller\NotifyController"){
            //过滤了 上传图片
        }else{
            apiCha($request->post(),$request->header());
        }
        //修改请求数据
        $response = $handler($request); // 继续向洋葱芯穿越，直至执行控制器得到响应
        return $response;
    }
}